package com.yd.app.service.pc.agentService;

import com.yd.app.mapper.AgentMapper;
import com.yd.app.mapper.AgreementMapper;
import com.yd.app.service.common.BaseService;
import com.yd.domain.business.Agreement;
import com.yd.domain.commom.PageModel;
import com.yd.domain.sys.Agent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 优惠券Service
 * Created by zg on 2018/3/9.
 */
@Service
public class AgentService extends BaseService {


    @Autowired
    AgentMapper agentMapper;

    /**
     * 查询列表
     * @return
     */
    public List<Agent> getAgentList() {
        List<Agent>list=agentMapper.getAgentList();
        return list;
    }

    /**
     * 删除代理商信息
     * @param agentId
     */
    public void deleteAgentById(String agentId) {
        agentMapper.deleteAgentById(agentId);
    }

    /**
     * 添加代理商
     * @param agent
     */
    public void addAgent(Agent agent) {
        agentMapper.addAgent(agent);
    }
    /**
     * 修改代理商
     * @param agent
     */
    public void updateAgent(Agent agent) {
        agentMapper.updateAgent(agent);
    }
    /**
     * 获取登录用户所注册的代理
     * @param userId
     * @return
     */
    public Agent getAgentByUser(String userId) {
        Agent agent=   agentMapper.getAgentByUser(userId);
        return agent;
    }
}